import { HIGH_PRIORITY } from '../config';
import RuleProvider from 'diagram-js/lib/features/rules/RuleProvider';

export default class CustomRules extends RuleProvider {
	constructor(eventBus) {
		console.log('CustomRules : ', eventBus);
		super(eventBus, HIGH_PRIORITY + 1);
		this.eventBus = eventBus;
		this.init();
	}
	init() {
		this.addRule('shape.create', HIGH_PRIORITY, function(context) {
			// return false
			const target = context.target;
			const targetBo = target.businessObject;
			if (targetBo.taskId && targetBo.taskId.includes('BlankNode')) {
				// console.log('shape.create : ', context);
				return false;
			} else {
				return false;
			}
		});
	}
}
CustomRules.$inject = ['eventBus'];
